import request from '@/plugins/axios'

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login',
    method: 'post',
    data: data
  })
}

// 登录方法
export function loginBySms(phone, code) {
  const data = {
    phone,
    code
  }
  return request({
    url: '/loginBySms',
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    method: 'get'
  })
}

export function sendLoginSmsCode(data) {
  return request({
    url: '/sms/sendLoginSmsCode',
    method: 'post',
    data: data
  })
}

// 获取路由
export const getRouters = () => {
  return request({
    url: '/getRouters',
    method: 'get'
  })
}

// 重置密码
export function resetPwdForNeedChange(data) {
  return request({
    url: '/sys/user/resetPwdForNeedChange',
    method: 'post',
    data: data
  })
}

// 修改密码
export function changeCurrentPwd(data) {
  return request({
    url: '/sys/user/changeCurrentPwd',
    method: 'post',
    data: data
  })
}
// 个人中心信息
export function currentInfo(data) {
  return request({
    url: '/sys/user/currentInfo',
    method: 'post',
    data: data
  })
}
// 个人中心信息
export function updateCurrentInfo(data) {
  return request({
    url: '/sys/user/updateCurrentInfo',
    method: 'post',
    data: data
  })
}